package com.myfum.mobile.tetris.data.shapes
{
	import com.myfum.mobile.tetris.Config;
	import com.myfum.mobile.tetris.data.cubes.CubeData;
	import com.myfum.mobile.tetris.data.cubes.DropingCubeData;
	
	public class IShapeData extends ShapeData
	{
		public function IShapeData()
		{
			super();
		}
		
		override public function rotate():void{
			var yp:int;
			var xp:int;
			var i:int;
			if(cubes[0].y == cubes[1].y){
				//change - to |
				yp = cubes[0].y;
				xp = cubes[0].x;
				for(i = 0;i<cubes.length;i++){
					cubes[i].y = yp - 3 + i;
					cubes[i].x = xp + 1;
				}
			}else{
				//change | to -
				yp = cubes[3].y;
				xp = cubes[3].x;
				for(i = 0;i<cubes.length;i++){
					cubes[i].y = yp;
					cubes[i].x = Math.min(Math.max(xp - 1, 0), Config.STAGE_WIDTH - 4) + i;
				}
			}
		}
		
		override public function undoRotate():void{
			rotate();
		}
	}
}